﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PMS.Client.Entities;
using PMS.Client.IDAL;

namespace PMS.Client.DAL
{
    public class OwnerAccess : WebAccess, IOwnerAccess
    {
        public OwnerAccess(GlobalValues globalValues)
            : base(globalValues)
        {
        }

        public string GetBuildings()
        {
            string uri = "/api/owner/buildings";
            return this.Get(uri);
        }

        public string GetOwners(string paramsJson, int index, int size)
        {
            string uri = $"/api/owner/page/{index}/{size}";

            StringContent content = new StringContent(paramsJson);
            content.Headers.ContentType =
                new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");

            return this.Post(uri, content);
        }

        public string GetQuarters()
        {
            string uri = "/api/owner/quarters";
            return this.Get(uri);
        }

        public string UpdateOwner(string ownerJson)
        {
            string uri = $"/api/owner/update";

            StringContent content = new StringContent(ownerJson);
            content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/json");

            return this.Post(uri, content);
        }

        public string DeleteOwner(int id)
        {
            string uri = $"/api/owner/delete/{id}";
            return this.Get(uri);
        }
    }
}
